home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 30.2 KB | 931 lines | [TEXT/MPS ] |
- // UWindow.h
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
-
- #ifndef __UWINDOW__
- #define __UWINDOW__
-
- // MacApp
-
- #ifndef __UCOMMAND__
- #include "UCommand.h"
- #endif
-
- #ifndef __USCRIPTABLEOBJECT__
- #include "UScriptableObject.h"
- #endif
-
- #ifndef __UVIEW__
- #include "UView.h"
- #endif
-
- // Toolbox
-
- // defines WindowRef
- #ifndef __QUICKDRAW__
- #include <Quickdraw.h>
- #endif
-
- //----------------------------------------------------------------------------------
- // External and forward class declarations.
- //----------------------------------------------------------------------------------
-
- class TDialogBehavior;
- class TDocument;
- #if qDrag
- class TList;
- #endif
- class TToolboxEvent;
-
- //----------------------------------------------------------------------------------
- // Constants
- //----------------------------------------------------------------------------------
-
- const short kFloatingWindowKind = 128; // the windowKind of floating windows
- const DescType cPalette = 'cPal';
-
- #if qDrag
- enum EDragCallbackStatus {eWindowNotInited, eNotInstalled, eInstalled};
- #endif // qDrag
-
- struct WindowFlags
- {
- private:
- unsigned short fWindowFlagBits;
-
- enum
- {
- kHasGoAwayMask = 0x8000,
- kResizableMask = 0x4000,
- kDoFirstClickMask = 0x2000,
- kFreeOnClosingMask = 0x1000,
- kDisposeOnFreeMask = 0x0800,
- kClosesDocumentMask = 0x0400,
- kOpenInitiallyMask = 0x0200,
- kMustAdaptToScreenMask = 0x0100,
- kStaggerMask = 0x0080,
- kMustForceOnScreenMask = 0x0040,
- kVertCenterMask = 0x0020,
- kHorzCenterMask = 0x0010,
- kFloatsMask = 0x0008,
- kHideOnSuspendMask = 0x0004,
- kGenerateActivatesMask = 0x0002
- // note that the low bit is used as filler…
- };
-
- public:
- void Initialize (void);
-
- Boolean GetHasGoAway (void);
- Boolean GetResizable (void);
- Boolean GetDoFirstClick (void);
- Boolean GetFreeOnClosing (void);
- Boolean GetDisposeOnFree (void);
- Boolean GetClosesDocument (void);
- Boolean GetOpenInitially (void);
- Boolean GetMustAdaptToScreen (void);
- Boolean GetStagger (void);
- Boolean GetMustForceOnScreen (void);
- Boolean GetVertCenter (void);
- Boolean GetHorzCenter (void);
- Boolean GetFloats (void);
- Boolean GetHideOnSuspend (void);
- Boolean GetGenerateActivates (void);
-
- void SetHasGoAway (unsigned short hasGoAway);
- void SetResizable (unsigned short resizable);
- void SetDoFirstClick (unsigned short doFirstClick);
- void SetFreeOnClosing (unsigned short freeOnClosing);
- void SetDisposeOnFree (unsigned short disposeOnFree);
- void SetClosesDocument (unsigned short closesDocument);
- void SetOpenInitially (unsigned short openInitially);
- void SetMustAdaptToScreen (unsigned short mustAdaptToScreen);
- void SetStagger (unsigned short stagger);
- void SetMustForceOnScreen (unsigned short mustForceOnScreen);
- void SetVertCenter (unsigned short vertCenter);
- void SetHorzCenter (unsigned short horzCenter);
- void SetFloats (unsigned short floats);
- void SetHideOnSuspend (unsigned short hideOnSuspend);
- void SetGenerateActivates (unsigned short generateActivates);
- };
-
- inline void WindowFlags::Initialize (void)
- {
- fWindowFlagBits = 0x0000;
- }
-
- inline Boolean WindowFlags::GetHasGoAway (void)
- {
- return (fWindowFlagBits & kHasGoAwayMask) >> 15;
- }
-
- inline Boolean WindowFlags::GetResizable (void)
- {
- return (fWindowFlagBits & kResizableMask) >> 14;
- }
-
- inline Boolean WindowFlags::GetDoFirstClick (void)
- {
- return (fWindowFlagBits & kDoFirstClickMask) >> 13;
- }
-
- inline Boolean WindowFlags::GetFreeOnClosing (void)
- {
- return (fWindowFlagBits & kFreeOnClosingMask) >> 12;
- }
-
- inline Boolean WindowFlags::GetDisposeOnFree (void)
- {
- return (fWindowFlagBits & kDisposeOnFreeMask) >> 11;
- }
-
- inline Boolean WindowFlags::GetClosesDocument (void)
- {
- return (fWindowFlagBits & kClosesDocumentMask) >> 10;
- }
-
- inline Boolean WindowFlags::GetOpenInitially (void)
- {
- return (fWindowFlagBits & kOpenInitiallyMask) >> 9;
- }
-
- inline Boolean WindowFlags::GetMustAdaptToScreen (void)
- {
- return (fWindowFlagBits & kMustAdaptToScreenMask) >> 8;
- }
-
- inline Boolean WindowFlags::GetStagger (void)
- {
- return (fWindowFlagBits & kStaggerMask) >> 7;
- }
-
- inline Boolean WindowFlags::GetMustForceOnScreen (void)
- {
- return (fWindowFlagBits & kMustForceOnScreenMask) >> 6;
- }
-
- inline Boolean WindowFlags::GetVertCenter (void)
- {
- return (fWindowFlagBits & kVertCenterMask) >> 5;
- }
-
- inline Boolean WindowFlags::GetHorzCenter (void)
- {
- return (fWindowFlagBits & kHorzCenterMask) >> 4;
- }
-
- inline Boolean WindowFlags::GetFloats (void)
- {
- return (fWindowFlagBits & kFloatsMask) >> 3;
- }
-
- inline Boolean WindowFlags::GetHideOnSuspend (void)
- {
- return (fWindowFlagBits & kHideOnSuspendMask) >> 2;
- }
-
- inline Boolean WindowFlags::GetGenerateActivates (void)
- {
- return (fWindowFlagBits & kGenerateActivatesMask) >> 1;
- }
-
-
-
-
- inline void WindowFlags::SetHasGoAway (unsigned short hasGoAway)
- {
- fWindowFlagBits |= hasGoAway << 15;
- }
-
- inline void WindowFlags::SetResizable (unsigned short resizable)
- {
- fWindowFlagBits |= resizable << 14;
- }
-
- inline void WindowFlags::SetDoFirstClick (unsigned short doFirstClick)
- {
- fWindowFlagBits |= doFirstClick << 13;
- }
-
- inline void WindowFlags::SetFreeOnClosing (unsigned short freeOnClosing)
- {
- fWindowFlagBits |= freeOnClosing << 12;
- }
-
- inline void WindowFlags::SetDisposeOnFree (unsigned short disposeOnFree)
- {
- fWindowFlagBits |= disposeOnFree << 11;
- }
-
- inline void WindowFlags::SetClosesDocument (unsigned short closesDocument)
- {
- fWindowFlagBits |= closesDocument << 10;
- }
-
- inline void WindowFlags::SetOpenInitially (unsigned short openInitially)
- {
- fWindowFlagBits |= openInitially << 9;
- }
-
- inline void WindowFlags::SetMustAdaptToScreen (unsigned short mustAdaptToScreen)
- {
- fWindowFlagBits |= mustAdaptToScreen << 8;
- }
-
- inline void WindowFlags::SetStagger (unsigned short stagger)
- {
- fWindowFlagBits |= stagger << 7;
- }
-
- inline void WindowFlags::SetMustForceOnScreen (unsigned short mustForceOnScreen)
- {
- fWindowFlagBits |= mustForceOnScreen << 6;
- }
-
- inline void WindowFlags::SetVertCenter (unsigned short vertCenter)
- {
- fWindowFlagBits |= vertCenter << 5;
- }
-
- inline void WindowFlags::SetHorzCenter (unsigned short horzCenter)
- {
- fWindowFlagBits |= horzCenter << 4;
- }
-
- inline void WindowFlags::SetFloats (unsigned short floats)
- {
- fWindowFlagBits |= floats << 3;
- }
-
- inline void WindowFlags::SetHideOnSuspend (unsigned short hideOnSuspend)
- {
- fWindowFlagBits |= hideOnSuspend << 2;
- }
-
- inline void WindowFlags::SetGenerateActivates (unsigned short generateActivates)
- {
- fWindowFlagBits |= generateActivates << 1;
- }
-
- //----------------------------------------------------------------------------------------
- // WMgrTWindow: Used by the window mapper
- //----------------------------------------------------------------------------------------
- struct WMgrTWindow
- {
- TWindow* itsTWindow;
- WindowRef itsWindow;
- };
-
- typedef WMgrTWindow* WMgrTWindowPtr;
-
- //----------------------------------------------------------------------------------
- // TWindow: Corresponds to a desktop Window. The outermost of a nested set of views.
- //----------------------------------------------------------------------------------
-
- class TWindow : public TView, public MScriptableObject
- {
- MA_DECLARE_CLASS;
-
- //------------------------------------------------------------------------------------
- // Creation/ Destruction Methods
- //------------------------------------------------------------------------------------
-
- public:
-
- TWindow();
- // Constructor
-
- void IWindow(TDocument* itsDocument,
- WindowRef itsWMgrWindow,
- Boolean canResize,
- Boolean canClose,
- Boolean disposeOnFree);
- // Initialize a window procedurally.
-
- virtual WindowRef GetBehindWindowPtr();
- // return the windowPtr in the windowlist behind which this window gets created
-
- virtual ~TWindow();
- // Frees the window if fDisposeOnFree is true, also deletes the window from the
- // document if there is one, otherwise deletes it from the applications list of
- // free windows.
-
- virtual TObject* Clone();
- // calls Inherited::Clone and then clones owned objects
-
- virtual void DoPostCreate(TDocument* itsDocument); // Override
- // sets the resize limits
-
- //------------------------------------------------------------------------------------
- // Standard signature support.
- //------------------------------------------------------------------------------------
-
- virtual IDType GetStandardSignature(); // override
- // Returns this class's standard signature.
-
- //------------------------------------------------------------------------------------
- // Stream I/O protocol support.
- //------------------------------------------------------------------------------------
-
- virtual void ReadFields(TStream* aStream); // override
-
- virtual void WriteFields(TStream* aStream); // override
-
- //------------------------------------------------------------------------------------
- // Open/Close Methods
- //------------------------------------------------------------------------------------
-
- virtual void BeInDocument(TDocument* itsDocument); // override
- // Assigns fDocument itsDocument by calling Inherited and then adds
- // itself to the document's window list
-
- virtual void Open();
- // Makes the window visible by showing it before calling Inherited::Open.
-
- virtual void DoClose(CommandNumber aCommand,
- Boolean useAppleEvent = TRUE);
- // Creates and posts a command which will close the window. Pass a FALSE
- // if the command is not to create an AppleEvent.
-
- virtual void Close();
- // Calls Inherited::Close and the hides & deactivates the window.
-
- virtual void CloseAndFree();
- // Calls and free the window if fFreeOnCompletion.
-
- virtual void CloseByUser(CommandNumber aCommandNumber);
- // If the window is shown and it can be closed handles the closing.
- // Returns FALSE if the user cancels closing.
-
- virtual void GoAwayByUser(const VPoint& theMouse);
- // Responsible for calling CloseByUser.
-
-
- //------------------------------------------------------------------------------------
- // Activation Methods
- //------------------------------------------------------------------------------------
-
- virtual void Activate(Boolean entering);
- // Activate the window.
-
-
- //------------------------------------------------------------------------------------
- // Size/ Location Methods
- //------------------------------------------------------------------------------------
-
- virtual void MoveByUser(const VPoint& theMouse);
- // Handles the user moving the window by dragging the title bar, calls DragWindow
- // to handle movement.
-
- virtual void ResizeByUser(const VPoint& theMouse);
- // Handles the user resizing the window by dragging the growbox, calls GrowWindow
- // to handle movement and Resize to resize the window.
-
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- // Used to resize the window by setting its frame to the parameters
- // passed in.
-
- virtual void Zoom(short partCode);
- // Responsible for actually handling the zooming of a window when the user clicks
- // in the zoombox.
-
- virtual void ZoomByUser(const VPoint& theMouse, short partCode);
- // handles the user clicking in the zoombox to zoom the window, calls Zoom.
-
- virtual void GetDynamicMoveBounds(CRect& moveBounds);
- // returns bounds over which the window may be moved. Honors fMoveBounds when non-zero
-
- virtual void GetDynamicResizeLimits(CRect& resizeLimits);
- // returns limits over which the window may be resized. Honors fResizeLimits when non-zero.
-
-
- //------------------------------------------------------------------------------------
- // Focusing Methods
- //------------------------------------------------------------------------------------
-
- virtual Boolean Focus();
- // Attempts to set the Focus to the window, returns true if it succeeds, false if
- // not.
-
- virtual Boolean FocusOnSuperView();
- // Attempts to set the Focus to our superview, returning true if it succeeds or
- // false if not.
-
-
- //------------------------------------------------------------------------------------
- // Drawing Methods
- //------------------------------------------------------------------------------------
-
- virtual void DrawResizeIcon();
- // Draws the grow icon by calling the toolbox routine DrawGrowIcon.
-
-
- //------------------------------------------------------------------------------------
- // Mouse Handling Methods
- //------------------------------------------------------------------------------------
-
- virtual Boolean HandleMouseDown(const VPoint& theMouse,
- TToolboxEvent* event,
- CPoint hysteresis,
- EMouseDownType mouseDownType = kDragOrClick);
- // Handles mouse downs in the window.
-
- virtual short GetPartCode(const VPoint& theMouse);
- // determines what part of the window theMouse is in
-
- virtual Boolean HasPendingUpdate();
- // Returns true if there is a pending update event for this window, false if not.
-
- virtual void BeginUpdate();
- // Encapsulates the Toolbox BeginUpdate.
-
- virtual void EndUpdate();
- // Encapsulates the Toolbox EndUpdate.
-
- virtual void Update();
- // Handle the update region and drawcontents on this.
-
- virtual void DoInvalidateRegion(const RgnHandle badRgn);
- // If a WMgrWindow is available calls InvalRgn
-
- virtual void DoValidateRegion(const RgnHandle goodRgn);
- // If a WMgrWindow is available calls ValidRgn
-
-
- //------------------------------------------------------------------------------------
- // Menu Handling Methods
- //------------------------------------------------------------------------------------
-
- virtual Boolean AllowsMenuAccess();
- // By default returns true.
-
- virtual void DoSetupMenus();
- // If the window is not modal calls Inherited::DoSetupMenus.
-
- virtual void DoMenuCommand(CommandNumber aCommandNumber);
- // Handles closing the window.
-
-
- //------------------------------------------------------------------------------------
- // Target and view management
- //------------------------------------------------------------------------------------
-
- virtual void DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event); // Override
-
- virtual void SetWindowTarget(TEventHandler* newTarget);
- // Sets the window's fTarget to 'newTarget'. When the window is activated,
- // newTarget will become the target
-
- virtual TEventHandler* GetWindowTarget();
- // Return the current fTarget of this window
-
- virtual void RemovedASubView(TView* theSubView);
- // Overridden to fix up the target, if the subview removed was the target
-
-
- //------------------------------------------------------------------------------------
- // Cursor Handling
- //------------------------------------------------------------------------------------
-
- virtual Boolean HandlesCursor(); // OVERRIDE
- // Returns true if fHandlesCursor is true, and the window is active, or
- // fDoFirstClick is true
-
- virtual Boolean LetsSubViewsHandleCursor(); // OVERRIDE
-
- virtual Boolean HandlesHelp(); // OVERRIDE
- // Returns the value of fDoesHandleHelp
-
- virtual Boolean LetsSubViewsHandleHelp(); // OVERRIDE
-
-
- //------------------------------------------------------------------------------------
- // Misc. Methods
- //------------------------------------------------------------------------------------
-
- virtual void AboutToLoseControl();
- // called when the application is about to lose control
-
- virtual void RegainControl();
- // called when the application is regaining control
-
- virtual void Show(Boolean state, Boolean redraw);
- // Called to make the window visible or not based on 'state'.
-
- virtual Boolean IsShown();
- // Returns true if the window is currently shown.
-
- virtual Boolean IsActive();
- // Returns true if the window is currently active.
-
- virtual void Select();
- // Called to select the window.
-
- virtual void SetTitle(const CStr255& newTitle);
- // Sets the windows title to 'newTitle'.
-
- virtual void GetTitle(CStr255& theTitle);
- // Gets the current title of the window.
-
- virtual void SetTitleForDoc(const CStr255& newDocTitle);// %%% AMB
- // Called when the documents name is known or changed
-
- virtual void AdaptToScreen();
- // Resizes the window to fit the screen on which it is being displayed.
-
- virtual void ForceOnScreen();
- // ForceOnScreen gaurantees that some minimal drag area is accessible to the user,
- // to be dragged to the desired location.
-
- virtual void Center(Boolean horizontally,
- Boolean vertically,
- Boolean forDialog);
- // Centers the window on the screen either horizontally, vertically or both.
-
- virtual void SimpleStagger(CPoint delta,
- short& counter);
- // Handles the staggering of windows as they are opened.
-
- virtual GrafPtr GetGrafPort();
- // Returns the windows GrafPtr.
-
- virtual GDHandle GetMaxIntersectedDevice(CRect& screenRect);
- // Returns the screenRect of the most intersected device & its GDHandle, or if CQD
- // isn't available it returns GetGrayRgn intersected with screenbits.bounds and
- // NULL for the GDHandle.
-
- virtual TWindow* GetWindow() const;
- // Returns this.
-
- virtual void SetResizeLimits(CPoint itsMinSize, CPoint itsMaxSize);
- // Used to set the limits to which the window can be resized.
-
- virtual Boolean RectInDrag(const CRect& whichRect);
- // Returns true if any of the corner points of whichRect are draggable.
-
- virtual Boolean IsHiddenOnSuspend();
- // Returns true if this window gets hidden when the application is suspended.
-
- virtual Boolean IsDismissed();
- // Returns true if this dialog has been dismissed.
-
- virtual void Dismiss(IDType dismisser, Boolean validate);
- // dismiss the dialog that is currently being posed modally
-
- virtual Boolean BuildWindowRegions(Boolean build);
- // IF build=kBuild THEN ensures that the window regions are valid; sets
- // fContentRegionInset, fContentDifference. Cleans up if necessary, when done with window
- // regions. Returns the old state of the window regions.
-
- virtual TDialogBehavior* GetDialogBehavior();
- // Returns the windows dialog behavior, if any.
-
- virtual void SetModality(Boolean modal);
- // Creates a TDialogBehavior object if necessary, and sets its modality.
-
- virtual void SetDialogItems(IDType itsDefaultItem,
- IDType itsCancelItem);
- // Creates a TDialogBehavior object if necessary, and sets its attributes.
-
-
- virtual IDType PoseModally();
- // poses this window in a modal state.
-
- virtual Boolean IsModal();
- // Returns true if this window is modal.
-
- virtual Boolean IsInModalState();
- // Returns true if this window is currently in a modal state.
-
- virtual void GetLocationAdjustment(CPoint& delta);
-
- virtual void GetStandardStateFrame(const VRect& boundingRect,
- VRect& stdFrame);
-
- virtual void GetUserStateFrame(const VRect& boundingRect,
- VRect& userFrame);
-
- //------------------------------------------------------------------------------------
- // Scripting Support
- //------------------------------------------------------------------------------------
-
- virtual DescType GetSpecifierForm(); // override
-
- virtual long CountContainedObjects(DescType desiredType);
-
- virtual TCommandHandler* GetCommandContext(const CommandNumber aCommandNumber) const;
-
- virtual MScriptableObject* GetContainedObject(DescType desiredType,
- DescType selectionForm,
- const CAEDesc& selectionData);
-
- virtual Boolean GetObjectProperty(CAEDesc& thePropertyValue,
- DescType whichProperty,
- const CAEDesc& desiredType);
-
- virtual void GetSetPropertyInfo(DescType whichProperty,
- CommandNumber& cmdNum,
- Boolean& canUndo,
- Boolean& causesChange,
- TCommandHandler* &theContext);
-
- virtual void SetObjectProperty(const CAEDesc& thePropertyValue,
- DescType whichProperty);
-
- virtual void DoAEClose(TAppleEvent* message,
- TAppleEvent* reply);
-
- virtual void DoAEMove(TAppleEvent* message,
- TAppleEvent* reply);
-
- virtual void DoAEPrint(TAppleEvent* message,
- TAppleEvent* reply);
-
- virtual void DoScriptCommand(CommandNumber aCommandNumber,
- TAppleEvent* message,
- TAppleEvent* reply);
-
- void SetScriptingPrintHandler(TPrintHandler* printHandler);
-
- void ReleaseScriptingPrintHandler(TPrintHandler* printHandler);
-
- #if qAttachable
- virtual Boolean HandleOSAEvent(CommandNumber aCommandNumber,
- TAppleEvent* message,
- TAppleEvent* reply);
- #endif
-
- #if qDrag
- //------------------------------------------------------------------------------------
- // Drag Support
- //------------------------------------------------------------------------------------
-
- virtual void RegisterDroppableView(TView* theView);
-
- // Droppable subviews register with the window. A list of these views
- // is maintained in fDroppableViewList
-
- virtual void UnregisterDroppableView(TView* theView);
-
- // Unregister a view when it is destroyed or loses its ability to receive drops
-
- virtual TView* MouseToDropTarget(CDragItemIterator& dragItemIterator,
- const CPoint& globalMouse,
- VPoint& localMouse);
-
- // Returns the TView that would accept the current drag. Returns
- // NULL if no eligible target exists. If a target is located, localMouse is
- // set to the mouse location in the target view's coordinate system
-
- virtual void DragEnteredWindow(CDragItemIterator& dragItemIterator);
- // Perform any pre-flight necessary to handle tracking a drag
-
- virtual void DragLeftWindow();
- // Perform any clean-up after a drag has exited
-
- #endif // qDrag
-
-
- //----------------------------------------------------------------------------------------
- // static functions
- //----------------------------------------------------------------------------------------
- public:
-
- static RgnHandle GetUpdateRegion(WindowPtr theWindow);
- // Return the correct updateRgn even if BeginUpdate has been called
-
- static RgnHandle GetVisRegion(GrafPtr theGrafPtr);
- // Return the correct visRgn even if BeginUpdate has been called
-
- static Boolean IsGhostWindow(WindowRef window);
-
- static Handle GetAndLoadWDefProc(Handle windowDefProc);
-
- static void HighlightAndActivateWindow(WindowRef theWindow, Boolean activate);
-
- static TWindow* WMgrToWindow(WindowRef aWMgrWindow);
- // Returns the window object that represents the given Window Manager window, or
- // NULL if there is no window object.
-
- static void DeleteWindow(TWindow* aWindow);
- // called when you have a new TWindow to track
-
- static void RegisterWindow(TWindow* aWindow);
- // called when freeing a TWindow
-
- static Boolean IsDocumentWindow(WindowRef aWindow);
-
- static Boolean IsDialog(WindowRef window);
-
- static Boolean IsFloatWindow(WindowRef window);
-
- static Boolean IsSystemWindow(WindowRef window);
-
- static Boolean IsModalWindow(WindowRef window);
-
- static WindowRef GetLastFloatingWindowPtr();
-
- static WindowRef GetFirstFloatingWindowPtr();
-
- static void MAActivateWindow(WindowRef theWindow);
-
- static void MADeactivateWindow(WindowRef theWindow);
-
- static void MADragWindow(WindowRef windowToDrag, CPoint startPoint, const CRect& draggingBounds);
-
- // Added for 3.5
- static void MASelectToolboxWindow(WindowRef windowToSelect);
- // "Selects" windowToSelect by calling the toolbox routine SelectWindow. When any
- // window is selected, it goes through here. We never call SelectWindow directly.
-
- static void MAShowWindow(WindowRef windowToShow);
-
- static void MAHideWindow(WindowRef windowToHide);
-
- static WindowRef MAFrontWindow();
-
- static WindowRef FreeIfWMgrWindow(WindowRef w,Boolean dispose);
- // Calls DisposeWindow if dispose is true, else calls CloseWindow. Does nothing if w
- // is NULL. Returns NULL for convenient assignment back to the reference passed in.
-
- //----------------------------------------------------------------------------------------
- // data members
- //----------------------------------------------------------------------------------------
- public:
-
- CRect fMoveBounds; // bounds over which the window may be
- // moved. Any value that is zero will be
- // dynamically calculated.
-
- CRect fResizeLimits; // limits over which the window may be
- // resized. Any value that is zero will be
- // dynamically calculated.
-
- CPoint fContentRegionInset; // topleft inset of cont rgn in struc rgn
-
- CPoint fContentDifference; // total amount the content is less than
- // and offset into the structure (Accounts
- // for title bar, etc.)
-
- TPrintHandler* fScriptingPrintHandler; // Print handler to invoke when the window
- // receives a print apple event
-
- TEventHandler* fTarget; // when this window is activated; the
- // TEventHandler to SetTarget on
-
- WindowRef fWMgrWindow; // the window manager window Ptr
-
- IDType fTargetID; // corresponding ID to fTarget
-
- short fProcID; // the proc ID of the window
-
- short fPreDocname; // amount of window title that precedes
- // the document name
-
- short fConstTitle; // amount of the title name that is
- // constant
-
- short fStrListID; // window's title: STR# rsrc id
-
- short fIndex; // index into STR#
-
- Boolean fUpdating; // True when TWindow::Update has control.
- // Changes behaviour of TWindow::Focus to
- // clip TO the update region instead of
- // clipping OUT the update region
-
- Boolean fIsActive; // is this window active
-
- Boolean fIsResizable; // is this window resizeable
-
- Boolean fIsClosable; // is this window closable
-
- Boolean fFreeOnClosing; // should this window free itself when it
- // closes
-
- Boolean fDisposeOnFree; // should the window manager window be
- // disposed when this window frees
-
- Boolean fClosesDocument; // does this window close the document
-
- Boolean fOpenInitially; // should this window be opened when its
- // document is asked to show its windows
-
- Boolean fDoFirstClick; // should a click in this window not only
- // select it if it is inactive but also be
- // sent to its contents
-
- Boolean fFloats; // does this window float above
- // non-floating windows
-
- Boolean fHideOnSuspend; // does this window get hid on suspend?
-
- Boolean fWasHiddenOnSuspend; // True if this window was hid on suspend
-
- Boolean fGenerateActivates; // a flag indicating whether or not
- // TWindow::Show should generate the
- // necessary activate events
-
- Boolean fMustAdapt; // does this window require adaption to
- // the screen
-
- Boolean fMustHorzCenter; // does this window require centering
- // horizontally
-
- Boolean fMustVertCenter; // does this window require centering
- // vertically
-
- Boolean fMustStagger; // does this window require staggering
-
- Boolean fMustForceOnScreen; // does this window require forcing on the
- // screen
-
- Boolean fAdapted; // has this window's size ever been
- // adapted to the screen
-
- Boolean fHorzCentered; // has this window been centered
- // horizontally
-
- Boolean fVertCentered; // has this window been centered
- // vertically
-
- Boolean fStaggered; // has this window been staggered
-
- Boolean fForcedOnScreen; // has this window been forced on the
- // screen
-
- #if qDrag
- //------------------------------------------------------------------------------------
- // Drag and Drop Data
- //------------------------------------------------------------------------------------
-
- EDragCallbackStatus fDragCallbackStatus; // enumerated type indicating whether or
- // not drag manager callbacks have been
- // installed for the window.
-
- TList* fDroppableViewList; // list of subviews that are droppable
-
- TDynamicArray* fDropStatusCache; // cache that maps to fDroppableViewList
- // that indicates whether views can or
- // can't receive the current drag
-
- #endif // qDrag
-
- //----------------------------------------------------------------------------------------
- // static data members
- //----------------------------------------------------------------------------------------
- public:
- static short gStandardWindowStaggerCount; // Used to stagger windows created from
- // templates
- protected:
- static Boolean pInBeginUpdate;
- static GrafPtr pInBeginUpdateWindowPtr;
-
- static RgnHandle pSavedUpdateRegion;
- static RgnHandle pSavedVisRegion;
- static CPoint pSavedVisRegionOriginalOffset;
-
- static TDynamicArray* gWindows;
- };
-
- //----------------------------------------------------------------------------------------
- // TCloseWindowCommand: Tells the application to close a window
- //----------------------------------------------------------------------------------------
-
- class TCloseWindowCommand : public TCommand
- {
- MA_DECLARE_CLASS;
-
- public:
- TCloseWindowCommand();
- // Constructor
- virtual ~TCloseWindowCommand();
- // Destructor
-
- void ICloseWindowCommand(CommandNumber itsCommandNumber,
- TWindow* itsWindow);
- void ICloseWindowCommand(TWindow* itsWindow,
- TAppleEvent* message,
- TAppleEvent* reply);
- // Initialize the CloseWindowCommand procedurally.
-
- virtual TAppleEvent* MakeAppleEvent();
-
- virtual void DoIt();
- // tell the application to close a window.
- //----------------------------------------------------------------------------------------
- // data members
- //----------------------------------------------------------------------------------------
- public:
- TWindow* fWindow; // The window to close
-
- protected:
- TAppleEvent* fMessage;
- TAppleEvent* fReply;
- };
-
- #endif
-
-
-